package com.example.goodrubish.Garbage;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.example.goodrubish.R;
//import androidx.viewpager.widget.ImageViewPager;

public class CarouselFragment extends Fragment {

    private int imageResId;

    public static CarouselFragment newInstance(int imageResId) {
        CarouselFragment fragment = new CarouselFragment();
        Bundle args = new Bundle();
        args.putInt("image_res_id", imageResId);
        fragment.setArguments(args);
        return fragment;
    }

    public CarouselFragment() {}

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            imageResId = getArguments().getInt("image_res_id");
        }
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_image_slide, container, false);
        ImageView imageView = view.findViewById(R.id.image_view);
        imageView.setImageResource(imageResId);
        return view;
    }
}
